﻿<PageFunction
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"        
    xmlns:res="clr-namespace:Caps.Console.My.Resources"
    xmlns:my="clr-namespace:Caps.Console"
    xmlns:convertersT="clr-namespace:Tools.WindowsT.WPF.ConvertersT;assembly=Tools.Windows"
    x:Class="pgCredentials"
    x:TypeArguments="sys:Boolean"
    KeepAlive="True"
    WindowTitle="{x:Static res:Resources.wiz_txt_DatabaseAndFileSelection}"
>
    <FrameworkElement.Resources>
        <convertersT:CompareConverterEx x:Key="CompareConverterEx"/>
    </FrameworkElement.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="10" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="10" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="10" />
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="10" />
        </Grid.RowDefinitions>

        <Label Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="23" Content="{x:Static res:Resources.wiz_txt_DatabaseAndFileInformation}"/>
        <Label Grid.Column="1" Grid.Row="2" Visibility="{Binding RequiresFileNameVisibility, Mode=OneWay}" Content="{x:Static res:Resources.wiz_txt_FilePath}"/>
        <TextBox Grid.Column="2" Grid.Row="2"  Visibility="{Binding RequiresFileNameVisibility, Mode=OneWay}" Name="txtDatabaseFile" Text="{Binding FilePath, Mode=TwoWay}"/>
        <Button Grid.Column="3" Grid.Row="2"  Visibility="{Binding RequiresFileNameVisibility, Mode=OneWay}" Name="btnDbBrowse" Content="{x:Static res:Resources.cmd_Browse}" ToolTip="{x:Static res:Resources.tot_Browse}"/>
        <Label Grid.Column="1" Grid.Row="3" Content="{x:Static res:Resources.wiz_txt_DatabaseServer}"/>
        <TextBox Grid.Column="2" Grid.Row="3" Text="{Binding ServerName, Mode=TwoWay}" Name="txtServer"/>
        <Button Grid.Column="3" Grid.Row="3" Name="btnDbServerBrowse" Content="{x:Static res:Resources.cmd_Browse}" ToolTip="{x:Static res:Resources.tot_Browse}"/>
        <RadioButton Grid.Column="1" Grid.ColumnSpan="3" Grid.Row="4" IsChecked="{Binding UseIntegratedSecurity, Mode=TwoWay}">
            <TextBlock Text="{x:Static res:Resources.wiz_txt_WindowsAuthentification}" TextWrapping="Wrap" />
        </RadioButton>
        <RadioButton Name="optSQLAuth" Grid.Column="1" Grid.ColumnSpan="3" Grid.Row="5" IsChecked="{Binding UseSqlServerAuth, Mode=TwoWay}"  >
            <TextBlock Text="{x:Static res:Resources.wiz_txt_SQLServerAuthentification}" TextWrapping="Wrap" />
        </RadioButton>
        <Label Grid.Column="1" Grid.Row="6" HorizontalAlignment="Right" IsEnabled="{Binding ElementName=optSQLAuth, Path=IsChecked, Mode=OneWay}" Content="{x:Static res:Resources.wiz_txt_UserName}"/>
        <TextBox Grid.Column="2" Grid.Row="6"  IsEnabled="{Binding ElementName=optSQLAuth, Path=IsChecked, Mode=OneWay}" Name="txtUserName" Text="{Binding UserName, Mode=TwoWay}" />
        <Label Grid.Column="1" Grid.Row="7" HorizontalAlignment="Right" IsEnabled="{Binding ElementName=optSQLAuth, Path=IsChecked, Mode=OneWay}" Content="{x:Static res:Resources.wiz_txt_Password}"/>
        <PasswordBox Grid.Column="2" Grid.Row="7"  IsEnabled="{Binding ElementName=optSQLAuth, Path=IsChecked, Mode=OneWay}" PasswordChar="✮" Name="txtPassword" />
        <Label Grid.Column="1" Grid.Row="8" Visibility="{Binding RequiresDatabaseNameVisibility, Mode=OneWay}" Content="{x:Static res:Resources.wiz_txt_DatabaseName}"/>
        <TextBox Grid.Column="2" Grid.Row="8"  Visibility="{Binding RequiresDatabaseNameVisibility, Mode=OneWay}" Name="txtDatabaseName" Text="{Binding DatabaseName, Mode=TwoWay}" />
        <Button Grid.Column="3" Grid.Row="8"  Visibility="{Binding RequiresExistingDatabaseNameVisibility, Mode=OneWay}" Name="btnDatabaseName" IsEnabled="{Binding ElementName=txtServer, Path=Text, Converter={StaticResource CompareConverterEx}, ConverterParameter='&lt;&gt;&quot;&quot;'}" Content="{x:Static res:Resources.cmd_Browse}" ToolTip="{x:Static res:Resources.tot_Browse}"/>

        <StackPanel Grid.Column="1" Grid.ColumnSpan="3" Grid.Row="9" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,10,0,0">
            <Button Name="backButton" Click="backButton_Click" Padding="5,0,5,0" xml:space="preserve" Content="{x:Static res:Resources.wiz_cmd_Back}"/>
            <Button Name="nextButton" IsEnabled="True" Padding="5,0,5,0" Margin="10,0,0,0" xml:space="preserve" Content="{x:Static res:Resources.wiz_cmd_Next}"/>
            <Button Name="cancelButton" Click="cancelButton_Click" Padding="5,0,5,0" Margin="10,0,0,0" IsCancel="True" Content="{x:Static res:Resources.wiz_cmd_Cancel}"/>
            <Button Name="finishButton" Click="finishButton_Click" Padding="5,0,5,0" Margin="10,0,0,0" IsDefault="True" IsEnabled="False" Content="{x:Static res:Resources.wiz_cmd_Finish}"/>
        </StackPanel>
    </Grid>
</PageFunction>